/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author jackie
 */
@Entity
@Table(name = "invitee")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Invitee.findAll", query = "SELECT i FROM Invitee i"),
    @NamedQuery(name = "Invitee.findById", query = "SELECT i FROM Invitee i WHERE i.id = :id"),
    @NamedQuery(name = "Invitee.findByEventID", query = "SELECT i FROM Invitee i WHERE i.eventID = :eventID and i.accepted = :accepted"),
    @NamedQuery(name = "Invitee.findByUserEmailAccepted", query = "SELECT i FROM Invitee i WHERE i.userEmail = :userEmail and i.accepted = :accepted"),
    @NamedQuery(name = "Invitee.findByUserEmail", query = "SELECT i FROM Invitee i WHERE i.userEmail = :userEmail ORDER BY i.id DESC"),
    @NamedQuery(name = "Invitee.findByAccepted", query = "SELECT i FROM Invitee i WHERE i.accepted = :accepted"),
    @NamedQuery(name = "Invitee.findByDeclined", query = "SELECT i FROM Invitee i WHERE i.declined = :declined")})
public class Invitee implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID")
    private Integer id;
    @Column(name = "accepted")
    private Boolean accepted;
    @Column(name = "declined")
    private Boolean declined;
    @JoinColumn(name = "EventID", referencedColumnName = "EventID")
    @ManyToOne(optional = false)
    private Event eventID;
    @JoinColumn(name = "UserEmail", referencedColumnName = "UserEmail")
    @ManyToOne(optional = false)
    private User userEmail;

    public Invitee() {
    }

    public Invitee(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Boolean getAccepted() {
        return accepted;
    }

    public void setAccepted(Boolean accepted) {
        this.accepted = accepted;
    }

    public Boolean getDeclined() {
        return declined;
    }

    public void setDeclined(Boolean declined) {
        this.declined = declined;
    }

    public Event getEventID() {
        return eventID;
    }

    public void setEventID(Event eventID) {
        this.eventID = eventID;
    }

    public User getUserEmail() {
        return userEmail;
    }

    public void setUserEmail(User userEmail) {
        this.userEmail = userEmail;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Invitee)) {
            return false;
        }
        Invitee other = (Invitee) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.entity.Invitee[ id=" + id + " ]";
    }
    
}
